<?php
    class app
	{
		static $_instance;
		
		// singleton
		public function &getInstance() 
		{
            if (!self::$_instance instanceof self) {
				self::$_instance = new self();
			}
            return self::$_instance;
		}
        
        public function __call($name, $args) 
        {
            if (substr($name, 0, 3) == 'get') {
                list($dummy, $var) = explode('get', $name, 2);
                $var = strtolower($var);
                return getvar("::$var::");
            }
            if (substr($name, 0, 3) == 'set') {
                list($dummy, $var) = explode('set', $name, 2);
                $var = strtolower($var);
                return setvar("::$var::", $args[0]);
            }
            return call_user_func_array($name, $args);
        }
    }
?>